package login;

public class User {
    private String userName;
    private String passWord;

    public User(String userName, String passWord) {
        this.userName = userName;
        passWord = passWord;
    }

    public void Login(String userName, String passWord) throws UserNameException,PassWordException {
        if(!this.userName.equals(userName)){
            //用户名错误
            throw new UserNameException("用户名错误");
        }
        if(!this.passWord.equals(passWord)){
            //密码错误
            throw new PassWordException("密码错误");
        }
    }

    public static void main(String[] args) throws UserNameException, PassWordException {
        User user = new User("小明","1024");
        user.Login("小花","128");
    }
}
